<script lang="ts" setup>
import { ref } from "vue";

// 轮播图数据
const schoolHireBanners = ref([
    {
        id: 1,
        title: "2023秋季互联网行业专场招聘会",
        description: "11月15日在线举办，50家知名互联网企业现场招聘",
        imageUrl: "http://cdn.wingtrace.cn/img/banner/vbanner01.jpg",
        buttonText: "立即报名",
        linkUrl: "/schoolHireInfo?id=1001",
    },
    {
        id: 2,
        title: "2023校园招聘季",
        description: "寻找优秀的你，加入我们的团队",
        imageUrl: "http://cdn.wingtrace.cn/img/banner/vbanner02.jpg",
        buttonText: "查看详情",
        linkUrl: "/schoolHireInfo?id=1002",
    },
]);
</script>

<template>
    <el-card class="banner-card">
        <el-carousel height="300px">
            <el-carousel-item v-for="banner in schoolHireBanners" :key="banner.id">
                <el-image :src="banner.imageUrl" fit="cover" style="width: 100%; height: 100%">
                    <template #placeholder>
                        <el-skeleton style="width: 100%; height: 100%" animated />
                    </template>
                </el-image>
                <div class="carousel-content">
                    <h2>{{ banner.title }}</h2>
                    <p>{{ banner.description }}</p>
                    <el-button type="primary" size="large" :to="banner.linkUrl" link>{{ banner.buttonText }}</el-button>
                </div>
            </el-carousel-item>
        </el-carousel>
    </el-card>
</template>

<style scoped>
.banner-card {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    border: none;
}

.carousel-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 10%;
    color: white;
    background: linear-gradient(120deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.2), transparent);
}

.carousel-content h2 {
    font-size: 32px;
    margin-bottom: 12px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.carousel-content p {
    font-size: 16px;
    margin-bottom: 24px;
    max-width: 600px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

:deep(.el-button) {
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 8px;
    transition: all 0.3s;
}

:deep(.el-button:hover) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

:deep(.el-carousel__button) {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

:deep(.el-carousel__arrow) {
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

:deep(.el-carousel__arrow:hover) {
    background-color: rgba(255, 255, 255, 0.5);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .carousel-content h2 {
        font-size: 22px;
    }

    .carousel-content p {
        font-size: 14px;
        margin-bottom: 16px;
    }
}
</style>
